package com.novax.ex.activity.provider.service;

import com.novax.ex.activity.infrastructure.entity.TaskData;
import com.novax.ex.activity.infrastructure.mapper.TaskDataMapper;
import com.novax.ex.common.base.BaseMapper;
import com.novax.ex.common.base.BaseService;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.Date;
import java.util.Objects;

@Service
public class TaskDataService extends BaseService {
    @Resource
    private TaskDataMapper taskDataMapper;

    @Override
    protected BaseMapper getBaseMapper() {
        return taskDataMapper;
    }

//    public Boolean insertOrUpdate(TaskData param) {
//        TaskData taskData = taskDataMapper.selectOneByUserId(param.getUserId());
//        int affectCount = 0;
//        if (Objects.isNull(taskData)) {
//            if (Objects.nonNull(param.getTwitter())) {
//                param.setTwitterTime(new Date());
//            } else {
//                param.setTelegramTime(new Date());
//            }
//            param.setUpdater(param.getUserId());
//            param.setCreator(param.getUserId());
//            affectCount = taskDataMapper.insertSelective(param);
//        } else {
//            if (Objects.nonNull(param.getTwitterTime())) {
//                param.setTwitterTime(new Date());
//            } else {
//                param.setTelegramTime(new Date());
//            }
//            param.setId(taskData.getId());
//            affectCount = taskDataMapper.updateByPrimaryKeySelective(param);
//        }
//        return affectCount > 0;
//    }
}
